﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;

namespace The_Manilla_Project
{
    public partial class Manilla : Form
    {
        public Manilla()
        {
            InitializeComponent();
        }
        private void Manilla_Load(object sender, EventArgs e)
        {
            string x;
            Manilla.ActiveForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox2.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox2.ImageLocation = x;//line 2
            }
            // set the app pics
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox1.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox1.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox3.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox3.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox4.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox4.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox5.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox5.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox6.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox6.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox7.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox7.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox8.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox8.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox9.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox9.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox10.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox10.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox11.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox11.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox12.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox12.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox13.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox13.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox14.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox14.ImageLocation = x;//line 2
                }
                x = file.ReadLine();
                if (x.StartsWith("\\FileSystem"))
                {
                    pictureBox15.ImageLocation = Properties.Settings.Default.pth + x;
                }
                else
                {
                    pictureBox15.ImageLocation = x;//line 2
                }
            file.Close();
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 16)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc1.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox3_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 17)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc2.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox4_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 18)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc3.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 19)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc4.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox6_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 20)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc5.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox7_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 21)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc6.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }
        private void pictureBox8_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 22)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc7.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox9_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 23)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc8.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox10_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 24)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc9.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox11_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 25)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc10.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox12_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 26)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc11.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox13_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 27)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc12.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox14_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 28)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc13.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void pictureBox15_Click(object sender, EventArgs e)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            int counter = 1;
            while (counter != 29)
            {
                file.ReadLine();
                counter++;
            }
            if (file.ReadLine() == "y")
            {
                string x = Properties.Settings.Default.pth + "\\apps\\prc14.exe";
                process1.StartInfo.FileName = x;
                process1.Start();
            }
            file.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (Manilla.ActiveForm.FormBorderStyle == System.Windows.Forms.FormBorderStyle.None)
            {
                Manilla.ActiveForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            }
            else
            {
                Manilla.ActiveForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            }
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if (Manilla.ActiveForm.FormBorderStyle == System.Windows.Forms.FormBorderStyle.None)
            {
                Manilla.ActiveForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
            }
            else
            {
                Manilla.ActiveForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            var edit = new edit();
            edit.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string x;
            Manilla.ActiveForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            System.IO.StreamReader file = new System.IO.StreamReader(Properties.Settings.Default.pth + "\\manilla.txt");
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox2.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox2.ImageLocation = x;//line 2
            }
            // set the app pics
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox1.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox1.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox3.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox3.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox4.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox4.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox5.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox5.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox6.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox6.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox7.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox7.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox8.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox8.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox9.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox9.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox10.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox10.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox11.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox11.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox12.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox12.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox13.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox13.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox14.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox14.ImageLocation = x;//line 2
            }
            x = file.ReadLine();
            if (x.StartsWith("\\FileSystem"))
            {
                pictureBox15.ImageLocation = Properties.Settings.Default.pth + x;
            }
            else
            {
                pictureBox15.ImageLocation = x;//line 2
            }
            file.Close();
        }

        private void ticky(object sender, EventArgs e)
        {
        }

        private void button4_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = Properties.Settings.Default.pth + "\\FileSystem";
            openFileDialog1.ShowDialog();
        }
    }
}
